<?php

/**
 * Cliente filter form base class.
 *
 * @package    reclamos
 * @subpackage filter
 * @author     Your name here
 */
abstract class BaseClienteFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'nombre'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'numero_cliente' => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'dni'            => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'depto'          => new sfWidgetFormFilterInput(),
      'calle'          => new sfWidgetFormFilterInput(),
      'numero'         => new sfWidgetFormFilterInput(),
      'piso'           => new sfWidgetFormFilterInput(),
      'telefono'       => new sfWidgetFormFilterInput(),
      'email'          => new sfWidgetFormFilterInput(),
      'localidad'      => new sfWidgetFormFilterInput(),
      'municipio'      => new sfWidgetFormFilterInput(),
      'codigo_postal'  => new sfWidgetFormFilterInput(),
      'tipo_cliente'   => new sfWidgetFormFilterInput(),
      'created_at'     => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'updated_at'     => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
    ));

    $this->setValidators(array(
      'nombre'         => new sfValidatorPass(array('required' => false)),
      'numero_cliente' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'dni'            => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'depto'          => new sfValidatorPass(array('required' => false)),
      'calle'          => new sfValidatorPass(array('required' => false)),
      'numero'         => new sfValidatorPass(array('required' => false)),
      'piso'           => new sfValidatorPass(array('required' => false)),
      'telefono'       => new sfValidatorPass(array('required' => false)),
      'email'          => new sfValidatorPass(array('required' => false)),
      'localidad'      => new sfValidatorPass(array('required' => false)),
      'municipio'      => new sfValidatorPass(array('required' => false)),
      'codigo_postal'  => new sfValidatorPass(array('required' => false)),
      'tipo_cliente'   => new sfValidatorPass(array('required' => false)),
      'created_at'     => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'updated_at'     => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
    ));

    $this->widgetSchema->setNameFormat('cliente_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Cliente';
  }

  public function getFields()
  {
    return array(
      'id'             => 'Number',
      'nombre'         => 'Text',
      'numero_cliente' => 'Number',
      'dni'            => 'Number',
      'depto'          => 'Text',
      'calle'          => 'Text',
      'numero'         => 'Text',
      'piso'           => 'Text',
      'telefono'       => 'Text',
      'email'          => 'Text',
      'localidad'      => 'Text',
      'municipio'      => 'Text',
      'codigo_postal'  => 'Text',
      'tipo_cliente'   => 'Text',
      'created_at'     => 'Date',
      'updated_at'     => 'Date',
    );
  }
}
